package com.ruoyi.web.controller.teacher;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.teacher.domain.Label;
import com.ruoyi.teacher.domain.Student;
import com.ruoyi.teacher.service.LabelServie;
import com.ruoyi.teacher.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/student")
public class StudentController {


    @Autowired
    private StudentService service;


    @Autowired
    private LabelServie labelServie;

    /**
     * 添加修改方法
     *
     * @param student
     * @return 结果
     */
    @PostMapping("/save")
    public AjaxResult sava(@RequestBody Student student) {
        service.save(student);
        return AjaxResult.success();
    }


    @GetMapping("/list")
    public AjaxResult list() {
        return service.List();
    }

    @DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable("id") Long id) {
        service.delete(id);
        return AjaxResult.success();
    }


    @GetMapping("/label")
    public AjaxResult labelList() {
        List<Label> list = labelServie.getList();
        return AjaxResult.success("200", list);
    }

}
